from numpy import array
from Location import Location

class Matrix(object):
    '''assigns blank, indexed Location objects to
    points to a matrix'''

    def __init__(self, length, width):
        ''' contains an array.  On initializing, the Locations
        do not have any attributes besides column and row coordinates.
        Those can be set later. '''
        self.array = array([[Location(x, y) for x in range(length+1)] for y in range(width+1)])
        self.length = length
        self.width = width

    def get_value(self, x, y):
        '''returns the Location object at an x,y coordinate
        in the sugarscape.
        This way, the user can change the Location object's attributes.
        We have no setter because there is no reason that the Location object should ever
        change, only its attributes.'''
        return self.array[y, x]

    def __str__(self):
        retVal = ""
        for line in self.array:
            retVal = retVal + str(line) + "\n"
        return str(retVal)

if __name__=='__main__':
    a = Matrix(2,5)
    print a
